# Contributor: Díaz Urbaneja Diego <sodomon2@gmail.com>
# Maintainer: Díaz Urbaneja Diego <sodomon2@gmail.com>
pkgname=warzone2100
pkgver=4.3.5
pkgrel=1
pkgdesc="3D realtime strategy game on a future Earth"
url="https://wz2100.net/"
# huge videogame
arch="x86_64"
license="GPL-2.0-or-later"
# todo: bundles some font-dejavu/font-noto-cjk, but needs patching
makedepends="
	asciidoc
	cmake
	curl-dev
	freetype-dev
	fribidi-dev
	gawk
	harfbuzz-dev
	libpng-dev
	libsodium-dev
	libtheora-dev
	libvorbis-dev
	mesa-dev
	openal-soft-dev
	opus-dev
	physfs-dev
	qt5-qtscript-dev
	samurai
	sdl2-dev
	sqlite-dev
	vulkan-headers
	zip
	zstd-dev
	"
subpackages="$pkgname-doc $pkgname-lang $pkgname-data::noarch"
source="$pkgname-$pkgver.tar.xz::https://github.com/Warzone2100/warzone2100/releases/download/$pkgver/warzone2100_src.tar.xz
	samurai.patch
	"
builddir="$srcdir/warzone2100"
options="!check" # who tests videogames

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DWZ_DISTRIBUTOR="AlpineLinux" \
		-DWZ_ENABLE_WARNINGS_AS_ERRORS=OFF \
		-DENABLE_DISCORD=OFF \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	depends="$pkgname-data=$pkgver-r$pkgrel"
	DESTDIR="$pkgdir" cmake --install build
}

data() {
	pkgdesc="Data files for warzone2100"

	amove usr/share/warzone2100
}

sha512sums="
ec65f22a0aad9fe482c4ea916cb321d171b10f0a9b181fea7db2eb17bf54e32b3828c8259082fff266713e2cab4e32dcc455d0d5b923a5ca221fc77b11137062  warzone2100-4.3.5.tar.xz
7f2998c29a3d6e94b0d475f1d467752568533fe9c84ffdee7a441f62cd8027aecbfdd990d4b1ea00099d6bc1776a0d88cb5b3336f802e274d93ea0740b421be2  samurai.patch
"
